﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using RoadTeam.SysInterface;
using System.Data;
using RoadTeam.Model;
using RoadTeam.Enums;

namespace RoadTeam.BsSystem.CS.HomeInspection
{
    class TbCsValidateRoom_Sys : ICsValidateRoom
    {

        public DataTable GetEmptyTable()
        {
            //ValidateRoomCode,FoundDate,ValidateStaffID,DeveloperOpinion
            //,SubjoinExplain,AuditingState,ValidateRoomState,UnitID,OrganID,App_Identifier
            SqlWhere where = new SqlWhere();
            where.SelectColumn = @"Top 0 ValidateRoomCode,FoundDate,ValidateStaffID,DeveloperOpinion
            ,SubjoinExplain,ValidateRoomState,UnitID,OrganID,App_Identifier ";
            return TbCsValidateRoom.Select(where, GlobalConfig.RtConnectionString);
        }

        public bool Insert(DataTable dt)
        {
            return TbCsValidateRoom.InsertDatatable(dt, GlobalConfig.RtConnectionString);
        }

        public String GetValidateRoomID(String Identifier)
        {
            SqlWhere where = new SqlWhere();
            where.Info = new TbCsValidateRoom() { App_Identifier = Identifier };
            where.SelectColumn = @"Top 1 ValidateRoomID";
            DataTable dt = TbCsValidateRoom.Select(where, GlobalConfig.RtConnectionString);

            if (dt.Rows.Count == 0) return @"-1";
            return dt.Rows[0][0].ToString();
        }


    }
}
